import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import json from '@rollup/plugin-json'
import alias from '@rollup/plugin-alias'
import terser from '@rollup/plugin-terser'

import path from 'path'

export default {
  input: 'src/index.ts', // 入口文件
  output: {
    file: 'dist/index.js', // 输出文件
    format: 'es', // CommonJS 格式
    sourcemap: true,
  },
  plugins: [
    alias({
      entries: [
        { find: '@', replacement: path.resolve(process.cwd(), './src') },
      ],
    }),
    // resolve(),
    // commonjs(),
    // json(),
    typescript(),
    // terser() // 压缩输出
  ],
  external: ['fs', 'path'], // 标记为外部模块
}
